package jmine.tec.persist.schema.embedded;

import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import jmine.tec.persist.schema.association.ValueEntity;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import bancosys.tec.component.Documentation;

@Embeddable
public class EmbeddedCEntity {

    private String descricao;

    private ValueEntity associations;

    /**
     * @return the associations
     */
    @ManyToOne
    @Cascade(CascadeType.SAVE_UPDATE)
    @Documentation("CODIGO DO VALOR")
    @JoinColumn(name = "COD_VALUE")
    public ValueEntity getAssociations() {
        return this.associations;
    }

    /**
     * @param associations the associations to set
     */
    public void setAssociations(ValueEntity associations) {
        this.associations = associations;
    }

    /**
     * @return the descricao
     */
    public String getDescricao() {
        return this.descricao;
    }

    /**
     * @param descricao the descricao to set
     */
    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

}
